#ifndef INTERPOLATER_H
#define INTERPOLATER_H

#include <QObject>
#include <QList>
#include <QDebug>
#include <QEventLoop>
#include <QThread>
#include "common.h"

class Interpolater : public QObject
{
    Q_OBJECT
public:
    explicit Interpolater(QObject *parent = 0);
    void setPeriod(int period); // unit: ms
    void setFeedRate(int feedrate); // unit: mm / min
    void interpolate(QList<BaseNode*> nodeList);
    void stop();
    void setKeepRunning();

signals:
    void output(double deltaX, double deltaY);

public slots:

private:
    int _period;
    int _feedrate;
    bool stopped;
    bool keepRunning;

    void interpolateOneLine(QPointF start, QPointF end);
};

#endif // INTERPOLATER_H
